<script>
	import {
		getConfig
	} from '@/service/api/common.js'
	import {
		getCartList
	} from '@/service/api/order.js'
	import {
		registerJsapi
	} from '@/service/request/main.js'
	export default {
		onLaunch: function() {
			console.log('App Launch')
			getConfig().then(([err, res]) => {
				console.log('getConfig', err, res)
				if (!err) {
					this.$store.commit('setGlobalConfig', res)
				}
			})
			this.$store.commit('initSystemInfo')

			// 加载购物车
			if (this.$store.getters.accessToken && this.$store.getters.shopId) {
				getCartList().then(([err, res]) => {
					console.log('getCartList', err, res)
					if (!err) {
						this.$store.commit('setCartList', res)
					}
				})
			}

			// #ifdef  H5
			registerJsapi()
			// #endif
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		created() {
			console.log('App created')
		},
		mounted() {
			console.log('App mounted')
		},
		updated() {
			console.log('App updated')
		},
		activated() {
			console.log('App activated')
		},
		deactivated() {
			console.log('App deactivated')
		},
		unmounted() {
			console.log('App unmounted')
		}
	}
</script>

<style lang="scss">
	@import './static/iconfont.css';

	/* input 样式 */
	.input-placeholder {
		color: #999999;
	}

	.placeholder {
		color: #999999;
	}

	/* 重置 open-data 的 button 样式 */
	.open-data-btn {
		background: none;
		margin-left: inherit;
		margin-right: inherit;
		line-height: inherit;
		padding-left: 0;
		padding-right: 0;

		&::after {
			border: none;
		}
	}

	.too-long {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
</style>
